<html>
<head>
  <script src="sorttable.js"></script>
  <script src="sourceview.js"></script>
  <link rel="stylesheet" type="text/css" href="style.css">
  <title>zcov: /home/vagrant/workspace/proj_libjpeg/cov/jcomapi.c</title>
</head>
<body>
<center><h1> zcov: <a href="index.html">/home/vagrant/workspace/proj_libjpeg/cov</a>/<a href="jcomapi.c.html">jcomapi.c</a> </h1></center>
<hr>


<center>
<table id="headertable" cellpadding=2>
  <tr>
    <td bgcolor=#ACACFF> <b>Files:</b> </td>
    <td bgcolor=#F0F0FF> 1 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Branches&nbsp;Taken:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>62.5%<b> </td>
    <td bgcolor=#F0F0FF align=right> 5&nbsp;/&nbsp;8 </td>
  </tr>
  <tr>
    <td bgcolor=#ACACFF> <b>Generated:</b> </td>
    <td bgcolor=#F0F0FF> 2016-04-07&nbsp;18:20 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Branches&nbsp;Executed:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>100.0%<b> </td>
    <td bgcolor=#F0F0FF align=right> 8&nbsp;/&nbsp;8 </td>
  </tr>
  <tr>
    <td colspan=2> </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Line&nbsp;Coverage:</b> </td>
    <td bgcolor=#F0F0FF align=right> <b>92.0%</b> </td>
    <td bgcolor=#F0F0FF align=right> 23&nbsp;/&nbsp;25 </td>
  </tr>
</table>
</center>
<p>
<hr>

<center>
<table id="fileheadertable" cellpadding=2>
  <tr>
    <td bgcolor=#ACACFF> <b>Programs:</b> </td>
    <td bgcolor=#F0F0FF> 1 </td>
    <td width="30"></td>
    <td bgcolor=#ACACFF> <b>Runs</b> </td>
    <td bgcolor=#F0F0FF align=right> 6326 </td>
  </tr>
</table>
</center>
<p>
<hr>

<pre>
<span class="lineNum">       1 </span>                : <I><FONT COLOR="#B22222">/*
<span class="lineNum">       2 </span>                :  * jcomapi.c
<span class="lineNum">       3 </span>                :  *
<span class="lineNum">       4 </span>                :  * Copyright (C) 1994-1997, Thomas G. Lane.
<span class="lineNum">       5 </span>                :  * This file is part of the Independent JPEG Group's software.
<span class="lineNum">       6 </span>                :  * For conditions of distribution and use, see the accompanying README file.
<span class="lineNum">       7 </span>                :  *
<span class="lineNum">       8 </span>                :  * This file contains application interface routines that are used for both
<span class="lineNum">       9 </span>                :  * compression and decompression.
<span class="lineNum">      10 </span>                :  */</FONT></I>
<span class="lineNum">      11 </span>                : 
<span class="lineNum">      12 </span>                : #<B><FONT COLOR="#5F9EA0">define</FONT></B> <FONT COLOR="#B8860B">JPEG_INTERNALS</FONT>
<span class="lineNum">      13 </span>                : #<B><FONT COLOR="#5F9EA0">include</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;jinclude.h&quot;</FONT></B>
<span class="lineNum">      14 </span>                : #<B><FONT COLOR="#5F9EA0">include</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;jpeglib.h&quot;</FONT></B>
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : 
<span class="lineNum">      17 </span>                : <I><FONT COLOR="#B22222">/*
<span class="lineNum">      18 </span>                :  * Abort processing of a JPEG compression or decompression operation,
<span class="lineNum">      19 </span>                :  * but don't destroy the object itself.
<span class="lineNum">      20 </span>                :  *
<span class="lineNum">      21 </span>                :  * For this, we merely clean up all the nonpermanent memory pools.
<span class="lineNum">      22 </span>                :  * Note that temp files (virtual arrays) are not allowed to belong to
<span class="lineNum">      23 </span>                :  * the permanent pool, so we will be able to close all temp files here.
<span class="lineNum">      24 </span>                :  * Closing a data source or destination, if necessary, is the application's
<span class="lineNum">      25 </span>                :  * responsibility.
<span class="lineNum">      26 </span>                :  */</FONT></I>
<span class="lineNum">      27 </span>                : 
<span class="lineNum">      28 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(<B><FONT COLOR="#228B22">void</FONT></B>)
<span class="lineNum">      29 </span><span class="lineCov">            2518: <B><FONT COLOR="#0000FF">jpeg_abort</FONT></B> (j_common_ptr cinfo)</span>
<span class="lineNum">      30 </span>                : {
<span class="lineNum">      31 </span>                :   <B><FONT COLOR="#228B22">int</FONT></B> pool;
<span class="lineNum">      32 </span>                : 
<span class="lineNum">      33 </span>                :   <I><FONT COLOR="#B22222">/* Do nothing if called on a not-initialized or destroyed JPEG object. */</FONT></I>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchTaken">            2518: branch 1 taken</span>
</span><span class="lineNum">      34 </span><span class="lineCov">            2518:   <B><FONT COLOR="#A020F0">if</FONT></B> (cinfo-&gt;mem == NULL)</span>
<span class="lineNum">      35 </span><span class="lineCov">            2518:     <B><FONT COLOR="#A020F0">return</FONT></B>;</span>
<span class="lineNum">      36 </span>                : 
<span class="lineNum">      37 </span>                :   <I><FONT COLOR="#B22222">/* Releasing pools in reverse order might help avoid fragmentation
<span class="lineNum">      38 </span>                :    * with some (brain-damaged) malloc libraries.
<span class="lineNum">      39 </span>                :    */</FONT></I>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchTaken">            2518: branch 0 taken</span>
<span class="lineNum">         </span><span class="branchTaken">            2518: branch 1 taken</span>
</span><span class="lineNum">      40 </span><span class="lineCov">            5036:   <B><FONT COLOR="#A020F0">for</FONT></B> (pool = JPOOL_NUMPOOLS-1; pool &gt; JPOOL_PERMANENT; pool--) {</span>
<span class="lineNum">      41 </span><span class="lineCov">            2518:     (*cinfo-&gt;mem-&gt;free_pool) (cinfo, pool);</span>
<span class="lineNum">      42 </span>                :   }
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span>                :   <I><FONT COLOR="#B22222">/* Reset overall state for possible reuse of object */</FONT></I>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchNotTaken">               0: branch 0 not taken</span>
<span class="lineNum">         </span><span class="branchTaken">            2518: branch 1 taken</span>
</span><span class="lineNum">      45 </span><span class="lineCov">            2518:   <B><FONT COLOR="#A020F0">if</FONT></B> (cinfo-&gt;is_decompressor) {</span>
<span class="lineNum">      46 </span><span class="lineNoCov">               0:     cinfo-&gt;global_state = DSTATE_START;</span>
<span class="lineNum">      47 </span>                :     <I><FONT COLOR="#B22222">/* Try to keep application from accessing now-deleted marker list.
<span class="lineNum">      48 </span>                :      * A bit kludgy to do it here, but this is the most central place.
<span class="lineNum">      49 </span>                :      */</FONT></I>
<span class="lineNum">      50 </span><span class="lineNoCov">               0:     ((j_decompress_ptr) cinfo)-&gt;marker_list = NULL;</span>
<span class="lineNum">      51 </span>                :   } <B><FONT COLOR="#A020F0">else</FONT></B> {
<span class="lineNum">      52 </span><span class="lineCov">            2518:     cinfo-&gt;global_state = CSTATE_START;</span>
<span class="lineNum">      53 </span>                :   }
<span class="lineNum">      54 </span>                : }
<span class="lineNum">      55 </span>                : 
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span>                : <I><FONT COLOR="#B22222">/*
<span class="lineNum">      58 </span>                :  * Destruction of a JPEG object.
<span class="lineNum">      59 </span>                :  *
<span class="lineNum">      60 </span>                :  * Everything gets deallocated except the master jpeg_compress_struct itself
<span class="lineNum">      61 </span>                :  * and the error manager struct.  Both of these are supplied by the application
<span class="lineNum">      62 </span>                :  * and must be freed, if necessary, by the application.  (Often they are on
<span class="lineNum">      63 </span>                :  * the stack and so don't need to be freed anyway.)
<span class="lineNum">      64 </span>                :  * Closing a data source or destination, if necessary, is the application's
<span class="lineNum">      65 </span>                :  * responsibility.
<span class="lineNum">      66 </span>                :  */</FONT></I>
<span class="lineNum">      67 </span>                : 
<span class="lineNum">      68 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(<B><FONT COLOR="#228B22">void</FONT></B>)
<span class="lineNum">      69 </span><span class="lineCov">            6309: <B><FONT COLOR="#0000FF">jpeg_destroy</FONT></B> (j_common_ptr cinfo)</span>
<span class="lineNum">      70 </span>                : {
<span class="lineNum">      71 </span>                :   <I><FONT COLOR="#B22222">/* We need only tell the memory manager to release everything. */</FONT></I>
<span class="lineNum">      72 </span>                :   <I><FONT COLOR="#B22222">/* NB: mem pointer is NULL if memory mgr failed to initialize. */</FONT></I>
<span class="branchGroup"><span class="lineNum">         </span><span class="branchTaken">            6309: branch 0 taken</span>
<span class="lineNum">         </span><span class="branchNotTaken">               0: branch 1 not taken</span>
</span><span class="lineNum">      73 </span><span class="lineCov">            6309:   <B><FONT COLOR="#A020F0">if</FONT></B> (cinfo-&gt;mem != NULL)</span>
<span class="lineNum">      74 </span><span class="lineCov">            6309:     (*cinfo-&gt;mem-&gt;self_destruct) (cinfo);</span>
<span class="lineNum">      75 </span><span class="lineCov">            6309:   cinfo-&gt;mem = NULL;		<I><FONT COLOR="#B22222">/* be safe if jpeg_destroy is called twice */</FONT></I></span>
<span class="lineNum">      76 </span><span class="lineCov">            6309:   cinfo-&gt;global_state = 0;	<I><FONT COLOR="#B22222">/* mark it destroyed */</FONT></I></span>
<span class="lineNum">      77 </span><span class="lineCov">            6309: }</span>
<span class="lineNum">      78 </span>                : 
<span class="lineNum">      79 </span>                : 
<span class="lineNum">      80 </span>                : <I><FONT COLOR="#B22222">/*
<span class="lineNum">      81 </span>                :  * Convenience routines for allocating quantization and Huffman tables.
<span class="lineNum">      82 </span>                :  * (Would jutils.c be a more reasonable place to put these?)
<span class="lineNum">      83 </span>                :  */</FONT></I>
<span class="lineNum">      84 </span>                : 
<span class="lineNum">      85 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(JQUANT_TBL *)
<span class="lineNum">      86 </span><span class="lineCov">           12652: <B><FONT COLOR="#0000FF">jpeg_alloc_quant_table</FONT></B> (j_common_ptr cinfo)</span>
<span class="lineNum">      87 </span>                : {
<span class="lineNum">      88 </span>                :   JQUANT_TBL *tbl;
<span class="lineNum">      89 </span>                : 
<span class="lineNum">      90 </span><span class="lineCov">           12652:   tbl = (JQUANT_TBL *)</span>
<span class="lineNum">      91 </span><span class="lineCov">           12652:     (*cinfo-&gt;mem-&gt;alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));</span>
<span class="lineNum">      92 </span><span class="lineCov">           12652:   tbl-&gt;sent_table = FALSE;	<I><FONT COLOR="#B22222">/* make sure this is false in any new table */</FONT></I></span>
<span class="lineNum">      93 </span><span class="lineCov">           12652:   <B><FONT COLOR="#A020F0">return</FONT></B> tbl;</span>
<span class="lineNum">      94 </span>                : }
<span class="lineNum">      95 </span>                : 
<span class="lineNum">      96 </span>                : 
<span class="lineNum">      97 </span>                : <B><FONT COLOR="#0000FF">GLOBAL</FONT></B>(JHUFF_TBL *)
<span class="lineNum">      98 </span><span class="lineCov">           25304: <B><FONT COLOR="#0000FF">jpeg_alloc_huff_table</FONT></B> (j_common_ptr cinfo)</span>
<span class="lineNum">      99 </span>                : {
<span class="lineNum">     100 </span>                :   JHUFF_TBL *tbl;
<span class="lineNum">     101 </span>                : 
<span class="lineNum">     102 </span><span class="lineCov">           25304:   tbl = (JHUFF_TBL *)</span>
<span class="lineNum">     103 </span><span class="lineCov">           25304:     (*cinfo-&gt;mem-&gt;alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));</span>
<span class="lineNum">     104 </span><span class="lineCov">           25304:   tbl-&gt;sent_table = FALSE;	<I><FONT COLOR="#B22222">/* make sure this is false in any new table */</FONT></I></span>
<span class="lineNum">     105 </span><span class="lineCov">           25304:   <B><FONT COLOR="#A020F0">return</FONT></B> tbl;</span>
<span class="lineNum">     106 </span>                : }
</pre>
<hr>
Generated: 2016-04-07&nbsp;18:20 by <a href="http://minormatter.com/zcov">zcov</a><br>
</body>
</html>
